<!DOCTYPE html>
<html>
<head>
<title>注 册</title>
<meta charset="utf-8" >
<meta name="renderer" content="webkit">
<meta name="author" content="XYB" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="format-detection" content="telphone=no, email=no"/>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/css/init.css">
<link rel="stylesheet" href="../../static/css/common.css">
<link rel="stylesheet" href="../../static/css/user/register.css">
<link rel="icon" href="../../static/images/favicon.ico" type="image/x-icon">
</head>
<body>
    <div class="allwarp">
		<div class="main-Content relative">
	    	<div class="register-page">
	    		<img class="register-badge" src="../../static/images/user/1.jpg"/>
	    		<div class="form">
	    			<form class="register-form">
	    				<div class="title mb-10 text-center f-18 c-333">注册</div>
						<input type="number" placeholder="用户名   不超过11位的数字" maxlength="11" id="r_nickname" />
						<input type="password" placeholder="密码   不超过15位的字符" maxlength="15" id="r_password" />
						<input type="password" placeholder="确认密码" maxlength="15" id="r_two_password" />
						<a href="javascript:;" id="register-pager-btn" class="mt-30" onclick="registerFun()">注 册</a>
					</form>
	    		</div>
	    	</div>
		</div>
    </div>
</body>
<script src="../../static/js/util/jquery-1.9.1.min.js"></script>
<script src="../../static/js/util/bootstrap.min.js"></script>
<script src="../../static/js/util/template.js"></script>
<script id="template" type="text/html"></script>
<script src="../../static/js/commonJS/interface.js"></script>
<script src="../../static/js/commonJS/common.js"></script>
<script>
	function registerFun(){
        var username = $("#r_nickname").val();
        var password = $("#r_password").val();
        var checkPassword = $("#r_two_password").val();

        if(username==""){
            $.message("请输入用户名");
            return;
        }
        if(password==""){
            $.message("请输入密码");
            return;
        }
        if(checkPassword==""){
            $.message("请输入确认密码");
            return;
        }
        if(password!=checkPassword){
            $.message("密码不一致");
            return;
        }


        $.ajax({
            url: register_interface,
            type:'post',
            dataType:'json',
			xhrFields:{
				withCredentials:true
			},
			crossDomain:true,
            data:{
                "username":username,
                "password":password,
				"checkPassword":password
            },
			xhrFields:{
				withCredentials:true
			},
			crossDomain:true,
            success: function(data) {
                if(data.code==200){
                    $.message("注册成功");
                    setTimeout(function(){
                        // location.href = 'seeBasicInfor.html#/modifyPwd?index=2';
						location.href = 'login.html';
                    },800);
                }else{
                    $.message(data.msg);
                }
            },
            error: function () {
                $.message("链接超时，请刷新...");
            }
        });
	}
</script>
</html>